<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fun" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set var="updateUrl" value="${contextPath}/portal/web/info/updateAdvancedAppDetail" scope="application"/>
<c:set var="resetUrl" value="${contextPath}/portal/web/resetClientSecret" scope="application"/>
      <div class="op_title">
        <div class="fl">
        	<span class="W_f14 W_fb">OAuth2.0 授权设置</span>
       	</div>
        <div class="fr">
        	<a href="javascript:;"  class="op_title_btn" >
	        	<span onclick="changePageInformation()">编辑</span>
        	</a>
       	</div>
      </div>
      <div class="info_form info_form_last form_table" style="display:none" id="showZone">
      	<form id="advanceForm" >
      		<input  name="appId" value="${appDetailsDto.appId}" type="hidden">
      		<input  name="clientId" value="${appDetailsDto.clientId}" type="hidden">
      		<input name="authorizedGrantTypes" value="authorization_code" type="hidden">
	      	<%-- <dl class="clearfix" >
				<dt>&nbsp;开放资源选择：</dt>
				<dd class="conbox conbox_checkbox"  >
					<input id="appCheckBox" value="${appDetailsDto.resourceIds}"  class="hide">
					<c:forEach items="${resourceList}" var="res">
						<span>
							<input ${fun:containsIgnoreCase(appDetailsDto.resourceIds, res.ids) ?'checked':''}
							name="resourceIds" id="checkBox20100" class="W_checkbox" value="${res.ids}" type="checkbox">
							<label for="checkBox20100" class="cholab">${res.name}</label>
						</span>
					</c:forEach>
				</dd>
				<dd class="tipbox" id="app_appCheckBox_error1"></dd>
			</dl> --%>
			<%-- <dl class="clearfix" >
				<dt>&nbsp;操作权限：</dt>
				<dd class="conbox conbox_checkbox"  >
					<select id="scope" name="scope" >
						<c:choose>
							<c:when test="${fun:containsIgnoreCase(appDetailsDto.scope, 'read')}">
								<c:choose>
									<c:when test="${fun:containsIgnoreCase(appDetailsDto.scope, 'write')}">
										<option value="read" >读</option>
										<option value="write" >写</option>
										<option value="read,write" selected="selected">读写</option>
									</c:when>
									<c:otherwise>
										<option value="read" selected="selected">读</option>
										<option value="write" >写</option>
										<option value="read,write" >读写</option>
									</c:otherwise>
								</c:choose>
							</c:when>
							<c:when test="${fun:containsIgnoreCase(appDetailsDto.scope, 'write')}">
								<c:choose>
									<c:when test="${fun:containsIgnoreCase(appDetailsDto.scope, 'read')}">
										<option value="read" >读</option>
										<option value="write" >写</option>
										<option value="read,write" selected="selected">读写</option>
									</c:when>
									<c:otherwise>
										<option value="read" >读</option>
										<option value="write" selected="selected">写</option>
										<option value="read,write" >读写</option>
									</c:otherwise>
								</c:choose>
							</c:when>
							<c:otherwise>
								<option value="read" >读</option>
								<option value="write">写</option>
								<option value="read,write" >读写</option>
							</c:otherwise>
						</c:choose>
	                </select>
				</dd>
				<dd class="tipbox" id="app_appCheckBox_error1"></dd>
			</dl> --%>
	        <dl class="clearfix">
	          <dt>授权回调页：</dt>
	          <dd class="conbox">
	            <input name="webServerRedirectUri" class="W_inputStp" value="${appDetailsDto.webServerRedirectUri}"  type="text">
	          </dd>
			  <dd data-tipsmsg="当用户授权你的应用后，开放平台会回调你填写的这个地址。如果应用绑定了域名，该域名下的回调页地址都有效。" class="tipbox warn_pos_3" >
				<div class="M_notice_warn">当用户授权你的应用后，开放平台会回调你填写的这个地址。如果应用绑定了域名，该域名下的回调页地址都有效。</div>
	          </dd>
	        </dl>
	        <dl class="p_btn clearfix">
	          <dt>&nbsp;</dt>
	          <dd class="conbox">
            	<button onclick="serializeFrom('${updateUrl}','advanceForm')" class="W_btn_b"><span>提交</span></button>
            	<button type="button" onclick="changePageInformation()" class="W_btn_a"><span>取消</span></button>
	          </dd>
	          <dd class="tipbox warn_pos_2">
				<div class="M_notice_warn">修改后立即生效</div>
	         </dd>
	        </dl>
        </form>
      </div>
      <div class="info_form info_form_last form_table"  id="editZone">
      	<%-- <dl class="clearfix">
          <dt>开放资源选择：</dt>
          <dd class="conbox" node-type="backurlZone">
          <c:forEach items="${resourceList}" var="res">
				<span>
					<c:if test="${fun:contains(appDetailsDto.resourceIds,res.ids)}">${res.name}</c:if>
				</span>
			</c:forEach>
          </dd>
        </dl> --%>
        <%-- <dl class="clearfix">
          <dt>操作权限：</dt>
          <dd class="conbox" node-type="backurlZone">
			<span>
				<c:choose>
					<c:when test="${fun:containsIgnoreCase(appDetailsDto.scope, 'read')}">
						<c:choose>
							<c:when test="${fun:containsIgnoreCase(appDetailsDto.scope, 'write')}">
								读写
							</c:when>
							<c:otherwise>
								读
							</c:otherwise>
						</c:choose>
					</c:when>
					<c:when test="${fun:containsIgnoreCase(appDetailsDto.scope, 'write')}">
						<c:choose>
							<c:when test="${fun:containsIgnoreCase(appDetailsDto.scope, 'read')}">
								读写
							</c:when>
							<c:otherwise>
								写
							</c:otherwise>
						</c:choose>
					</c:when>
				</c:choose>
			</span>
          </dd>
        </dl> --%>
        <dl class="clearfix">
          <dt>授权回调页：</dt>
          <dd class="conbox" node-type="backurlZone">
          	<c:choose>
          		<c:when test="${appDetailsDto.webServerRedirectUri !=null}">
          			${appDetailsDto.webServerRedirectUri}
          		</c:when>
          		<c:otherwise>
          			未填写
          		</c:otherwise>
          	</c:choose>
          </dd>
        </dl>
      </div>
            <!-- op_title -->
      <div class="op_title">
        <div class="fl"><span class="W_f14 W_fb">重置App Secret</span></div>
      </div>
      <!-- /op_title -->
      <div class="info_form info_form_last form_table">
        <dl class="clearfix">
          <dd class="conbox conbox_wid1">
          	<span class="mar_r" node-type="securtZone" id="clientSecret">
          		${appDetailsDto.clientSecret}
          	</span>
          	<a href="javascript:;" node-type="resetSecurtBtn" class="W_btn_a">
          		<span onclick="resetClientSecret('${resetUrl}','${appDetailsDto.clientId}')">重置</span>
          	</a>
          </dd>
          <dd class="tipbox warn_pos_2">
            <div class="M_notice_warn">如果App Secret泄露，可以通过重置更换，原App Secret将作废</div>
          </dd>
        </dl>
      </div>
    <script type="text/javascript" charset="utf-8">
		$(document).ready(function() {
			$("body").removeClass().addClass("B_op_info");
		});
	</script>
      
    